package com.qian.apiserver.service;

import com.qian.apiserver.dao.WordDao;
import com.qian.apiserver.service.IWordService;
import com.qian.apiserver.model.Word;
import com.qian.apiserver.entity.GmWord;
import org.springframework.beans.factory.annotation.Autowired;
import com.yaowk.service.common.BaseRepository;
import java.lang.String;
import com.yaowk.service.common.BaseServiceImpl;
import java.lang.Integer;

public abstract class WordServiceBase extends BaseServiceImpl<Word, GmWord, Integer> implements IWordService {

	@Autowired
	private WordDao dao;

	@Override protected WordDao getDao() {
	return dao;
	}

	@Override
	protected Word entity2model(GmWord entity) {
		Word model = null;
		if(isNotEmpty(entity)){
			model = new Word();
			model.setId(entity.getId());
			model.setWord(entity.getWord());
		}
		return model;
	}

	@Override
	protected GmWord model2Entity(Word model) {
		GmWord entity = null;
		if(isNotEmpty(model)){
			entity = new GmWord();
			entity.setId(model.getId());
			entity.setWord(model.getWord());
		}
		return entity;
	}

	@Override
	protected GmWord updateParams(Word model) {
		GmWord entity = dao.findOne(model.getId());
		if(isNotEmpty(model.getWord()))
			entity.setWord(model.getWord());
		return entity;
	}


}